home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / DOpus_CleanRAMDisk / cleanramdisk.dopus < prev    next >
Text File  |  1994-08-22  |  2KB  |  75 lines

  1. /* CleanRAMdisk.dopus V1.0
  2.    written in 1994 by Roland Schwingel
  3.                       Lilienthalstraße 9
  4.                       92421 Schwandorf
  5.                       Germany
  6.  
  7.    Description:
  8.    Erases all files and subdirs within "RAM:" or "Ram Disk:" except:
  9.    - Clipboards/
  10.    - ENV/
  11.    - T/
  12.    - Disk.info
  13.  
  14.    **** USE ENTIRELY AT YOUR OWN RISK ! ****
  15. */
  16.  
  17. /* ----------------------- main routine --------------------- */
  18. options results    /* need results */
  19.  
  20. parse arg portname
  21. if portname~=='' then
  22.  address(portname)
  23. else
  24.  portname=address()
  25.  
  26. 'busy on'            /* busy mouse pointer on */
  27. call get_win_and_path
  28.  
  29. if((diskname~=='RAM:') & (diskname ~== 'RAM DISK:')) then
  30. do
  31.     /* This window contains no ramdisk look into the other window*/
  32.     'otherwindow'
  33.     call get_win_and_path
  34.  
  35.     if((diskname ~== 'RAM:') & (diskname ~== 'RAM DISK:')) then
  36.     do
  37.       /* Also no Ramdisk in other window*/
  38.       'otherwindow'              /* back to first active window */
  39.       call get_win_and_path
  40.       'ScanDir RAM: ' || win                  /* read Ramdisk */
  41.       call cleandisk
  42.       'ScanDir "' || oldpath || '" ' || win   /* read old directory */
  43.     end
  44.     else
  45.     do
  46.      /* This window is Ramdisk */
  47.      call cleandisk
  48.      'otherwindow'
  49.     end
  50. end
  51. else
  52.  /* window with ramdisk found */
  53.  call cleandisk
  54.  
  55. 'busy off'                   /* busy mousepointer off */
  56. exit
  57.  
  58. /* ------------------------ Get path and window ------------- */
  59. get_win_and_path:
  60.     'status 3'          /* get active window number */
  61.     win=result
  62.  
  63.     'status 13 ' || win /* get path of Window */
  64.     oldpath=result
  65.     diskname=upper(oldpath)
  66. return
  67.  
  68. /* ------------------------- clean disk --------------------- */
  69. cleandisk:
  70.     'None'                 /* clear possible selection */
  71.     'Select ~(Clipboards|ENV|T|Disk.info) name'
  72.     'Delete'               /* get rid of it */
  73. return
  74.  
  75.